package filter;

import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.ActionContext;
import org.nutz.mvc.ActionFilter;
import org.nutz.mvc.View;
@IocBean
public class MainFilter implements ActionFilter{
	@Inject
	private GibbsFilter[] filters ;
	
	public GibbsFilter[] getFilters() {
		return filters;
	}

	public void setFilters(GibbsFilter[] filters) {
		this.filters = filters;
	}

	@Override
	public View match(ActionContext actionContext) {
		for(GibbsFilter filter : filters){
			View v = filter.filt(actionContext) ;
			if(v!=null) return v ;
		}
		return null;
	}

}
